package com.ccys.db.mapper;

import com.ccys.db.entity.SysUserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;

/**
* Created by Mybatis Generator on 2023/12/08
*/
public interface SysUserRoleMapper extends Mapper<SysUserRole>, MySqlMapper<SysUserRole> {

    @Delete("delete " +
            "from " +
            "sys_user_role " +
            "where " +
            "account_id = #{userId}")
    int deleteRelation(@Param("userId") String userId);

    /**
     * 更新用户角色信息 放置于一条commit
     * @param userId
     * @param roleIds
     * @return
     */
    int insertRelation(@Param("userId") String userId,
                       @Param("roleIds") List<String> roleIds,
                       @Param("createdBy") String createdBy);
}